home *** CD-ROM | disk | FTP | other *** search
/ Utilities Professional 1-1500 / Utilities Professional 1-1500 (1994)(WPD)[!].iso / 12511500 / var1432.dms / var1432.adf / NDUK-V40.lha / V40 / include / graphics / gels.h < prev    next >
C/C++ Source or Header  |  1993-10-15  |  9KB  |  269 lines

  1. #ifndef    GRAPHICS_GELS_H
  2. #define    GRAPHICS_GELS_H
  3. /*
  4. **    $VER: gels.h 39.0 (21.8.91)
  5. **    Includes Release 40.15
  6. **
  7. **    include file for AMIGA GELS (Graphics Elements)
  8. **
  9. **    (C) Copyright 1985-1993 Commodore-Amiga, Inc.
  10. **        All Rights Reserved
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. /* VSprite flags */
  18. /* user-set VSprite flags: */
  19. #define SUSERFLAGS  0x00FF    /* mask of all user-settable VSprite-flags */
  20. #define VSPRITE     0x0001    /* set if VSprite, clear if Bob */
  21. #define SAVEBACK    0x0002    /* set if background is to be saved/restored */
  22. #define OVERLAY     0x0004    /* set to mask image of Bob onto background */
  23. #define MUSTDRAW    0x0008    /* set if VSprite absolutely must be drawn */
  24. /* system-set VSprite flags: */
  25. #define BACKSAVED   0x0100    /* this Bob's background has been saved */
  26. #define BOBUPDATE   0x0200    /* temporary flag, useless to outside world */
  27. #define GELGONE     0x0400    /* set if gel is completely clipped (offscreen) */
  28. #define VSOVERFLOW  0x0800    /* VSprite overflow (if MUSTDRAW set we draw!) */
  29.  
  30. /* Bob flags */
  31. /* these are the user flag bits */
  32. #define BUSERFLAGS  0x00FF    /* mask of all user-settable Bob-flags */
  33. #define SAVEBOB     0x0001    /* set to not erase Bob */
  34. #define BOBISCOMP   0x0002    /* set to identify Bob as AnimComp */
  35. /* these are the system flag bits */
  36. #define BWAITING    0x0100    /* set while Bob is waiting on 'after' */
  37. #define BDRAWN        0x0200    /* set when Bob is drawn this DrawG pass*/
  38. #define BOBSAWAY    0x0400    /* set to initiate removal of Bob */
  39. #define BOBNIX        0x0800    /* set when Bob is completely removed */
  40. #define SAVEPRESERVE 0x1000   /* for back-restore during double-buffer*/
  41. #define OUTSTEP     0x2000    /* for double-clearing if double-buffer */
  42.  
  43. /* defines for the animation procedures */
  44. #define ANFRACSIZE  6
  45. #define ANIMHALF    0x0020
  46. #define RINGTRIGGER 0x0001
  47.  
  48.  
  49. /* UserStuff definitions
  50.  *  the user can define these to be a single variable or a sub-structure
  51.  *  if undefined by the user, the system turns these into innocuous variables
  52.  *  see the manual for a thorough definition of the UserStuff definitions
  53.  *
  54.  */
  55. #ifndef VUserStuff          /* VSprite user stuff */
  56. #define VUserStuff WORD
  57. #endif
  58.  
  59. #ifndef BUserStuff          /* Bob user stuff */
  60. #define BUserStuff WORD
  61. #endif
  62.  
  63. #ifndef AUserStuff          /* AnimOb user stuff */
  64. #define AUserStuff WORD
  65. #endif
  66.  
  67.  
  68.  
  69.  
  70. /*********************** GEL STRUCTURES ***********************************/
  71.  
  72. struct VSprite
  73. {
  74. /* --------------------- SYSTEM VARIABLES ------------------------------- */
  75. /* GEL linked list forward/backward pointers sorted by y,x value */
  76.     struct VSprite   *NextVSprite;
  77.     struct VSprite   *PrevVSprite;
  78.  
  79. /* GEL draw list constructed in the order the Bobs are actually drawn, then
  80.  *  list is copied to clear list
  81.  *  must be here in VSprite for system boundary detection
  82.  */
  83.     struct VSprite   *DrawPath;     /* pointer of overlay drawing */
  84.     struct VSprite   *ClearPath;    /* pointer for overlay clearing */
  85.  
  86. /* the VSprite positions are defined in (y,x) order to make sorting
  87.  *  sorting easier, since (y,x) as a long integer
  88.  */
  89.     WORD OldY, OldX;          /* previous position */
  90.  
  91. /* --------------------- COMMON VARIABLES --------------------------------- */
  92.     WORD Flags;          /* VSprite flags */
  93.  
  94.  
  95. /* --------------------- USER VARIABLES ----------------------------------- */
  96. /* the VSprite positions are defined in (y,x) order to make sorting
  97.  *  sorting easier, since (y,x) as a long integer
  98.  */
  99.     WORD Y, X;              /* screen position */
  100.  
  101.     WORD Height;
  102.     WORD Width;          /* number of words per row of image data */
  103.     WORD Depth;          /* number of planes of data */
  104.  
  105.     WORD MeMask;          /* which types can collide with this VSprite*/
  106.     WORD HitMask;          /* which types this VSprite can collide with*/
  107.  
  108.     WORD *ImageData;          /* pointer to VSprite image */
  109.  
  110. /* borderLine is the one-dimensional logical OR of all
  111.  *  the VSprite bits, used for fast collision detection of edge
  112.  */
  113.     WORD *BorderLine;          /* logical OR of all VSprite bits */
  114.     WORD *CollMask;          /* similar to above except this is a matrix */
  115.  
  116. /* pointer to this VSprite's color definitions (not used by Bobs) */
  117.     WORD *SprColors;
  118.  
  119.     struct Bob *VSBob;          /* points home if this VSprite is part of
  120.                    a Bob */
  121.  
  122. /* planePick flag:  set bit selects a plane from image, clear bit selects
  123.  *  use of shadow mask for that plane
  124.  * OnOff flag: if using shadow mask to fill plane, this bit (corresponding
  125.  *  to bit in planePick) describes whether to fill with 0's or 1's
  126.  * There are two uses for these flags:
  127.  *    - if this is the VSprite of a Bob, these flags describe how the Bob
  128.  *      is to be drawn into memory
  129.  *    - if this is a simple VSprite and the user intends on setting the
  130.  *      MUSTDRAW flag of the VSprite, these flags must be set too to describe
  131.  *      which color registers the user wants for the image
  132.  */
  133.     BYTE PlanePick;
  134.     BYTE PlaneOnOff;
  135.  
  136.     VUserStuff VUserExt;      /* user definable:  see note above */
  137. };
  138.  
  139. struct Bob
  140. /* blitter-objects */
  141. {
  142. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  143.  
  144. /* --------------------- COMMON VARIABLES --------------------------------- */
  145.     WORD Flags;    /* general purpose flags (see definitions below) */
  146.  
  147. /* --------------------- USER VARIABLES ----------------------------------- */
  148.     WORD *SaveBuffer;    /* pointer to the buffer for background save */
  149.  
  150. /* used by Bobs for "cookie-cutting" and multi-plane masking */
  151.     WORD *ImageShadow;
  152.  
  153. /* pointer to BOBs for sequenced drawing of Bobs
  154.  *  for correct overlaying of multiple component animations
  155.  */
  156.     struct Bob *Before; /* draw this Bob before Bob pointed to by before */
  157.     struct Bob *After;    /* draw this Bob after Bob pointed to by after */
  158.  
  159.     struct VSprite   *BobVSprite;   /* this Bob's VSprite definition */
  160.  
  161.     struct AnimComp  *BobComp;        /* pointer to this Bob's AnimComp def */
  162.  
  163.     struct DBufPacket *DBuffer;     /* pointer to this Bob's dBuf packet */
  164.  
  165.     BUserStuff BUserExt;        /* Bob user extension */
  166. };
  167.  
  168. struct AnimComp
  169. {
  170. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  171.  
  172. /* --------------------- COMMON VARIABLES --------------------------------- */
  173.     WORD Flags;            /* AnimComp flags for system & user */
  174.  
  175. /* timer defines how long to keep this component active:
  176.  *  if set non-zero, timer decrements to zero then switches to nextSeq
  177.  *  if set to zero, AnimComp never switches
  178.  */
  179.     WORD Timer;
  180.  
  181. /* --------------------- USER VARIABLES ----------------------------------- */
  182. /* initial value for timer when the AnimComp is activated by the system */
  183.     WORD TimeSet;
  184.  
  185. /* pointer to next and previous components of animation object */
  186.     struct AnimComp  *NextComp;
  187.     struct AnimComp  *PrevComp;
  188.  
  189. /* pointer to component component definition of next image in sequence */
  190.     struct AnimComp  *NextSeq;
  191.     struct AnimComp  *PrevSeq;
  192.  
  193.     WORD (*AnimCRoutine)(); /* address of special animation procedure */
  194.  
  195.     WORD YTrans;     /* initial y translation (if this is a component) */
  196.     WORD XTrans;     /* initial x translation (if this is a component) */
  197.  
  198.     struct AnimOb    *HeadOb;
  199.  
  200.     struct Bob         *AnimBob;
  201. };
  202.  
  203. struct AnimOb
  204. {
  205. /* --------------------- SYSTEM VARIABLES --------------------------------- */
  206.     struct AnimOb    *NextOb, *PrevOb;
  207.  
  208. /* number of calls to Animate this AnimOb has endured */
  209.     LONG Clock;
  210.  
  211.     WORD AnOldY, AnOldX;        /* old y,x coordinates */
  212.  
  213. /* --------------------- COMMON VARIABLES --------------------------------- */
  214.     WORD AnY, AnX;            /* y,x coordinates of the AnimOb */
  215.  
  216. /* --------------------- USER VARIABLES ----------------------------------- */
  217.     WORD YVel, XVel;            /* velocities of this object */
  218.     WORD YAccel, XAccel;        /* accelerations of this object */
  219.  
  220.     WORD RingYTrans, RingXTrans;    /* ring translation values */
  221.  
  222.     WORD (*AnimORoutine)();        /* address of special animation
  223.                        procedure */
  224.  
  225.     struct AnimComp  *HeadComp;     /* pointer to first component */
  226.  
  227.     AUserStuff AUserExt;        /* AnimOb user extension */
  228. };
  229.  
  230. /* dBufPacket defines the values needed to be saved across buffer to buffer
  231.  *  when in double-buffer mode
  232.  */
  233. struct DBufPacket
  234. {
  235.     WORD BufY, BufX;            /* save the other buffers screen coordinates */
  236.     struct VSprite   *BufPath;        /* carry the draw path over the gap */
  237.  
  238. /* these pointers must be filled in by the user */
  239. /* pointer to other buffer's background save buffer */
  240.     WORD *BufBuffer;
  241. };
  242.  
  243.  
  244.  
  245. /* ************************************************************************ */
  246.  
  247. /* these are GEL functions that are currently simple enough to exist as a
  248.  *  definition.  It should not be assumed that this will always be the case
  249.  */
  250. #define InitAnimate(animKey) {*(animKey) = NULL;}
  251. #define RemBob(b) {(b)->Flags |= BOBSAWAY;}
  252.  
  253.  
  254. /* ************************************************************************ */
  255.  
  256. #define B2NORM        0
  257. #define B2SWAP        1
  258. #define B2BOBBER    2
  259.  
  260. /* ************************************************************************ */
  261.  
  262. /* a structure to contain the 16 collision procedure addresses */
  263. struct collTable
  264. {
  265.     int (*collPtrs[16])();
  266. };
  267.  
  268. #endif    /* GRAPHICS_GELS_H */
  269.